#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) JoinQuant Development Team
# Author: Huayong Kuang <kuanghuayong@joinquant.com>

import sys
import logging


logging.basicConfig(
    stream=sys.stdout,
    level=logging.INFO,
    format="%(asctime)s - %(levelname)s - %(message)s",
)


TestError = type("TestError", (Exception,), {})

for i in range(5):
    try:
        if i == 0:
            raise TestError("test error")
        if i == 3:
            raise Exception("test error")
    except TestError:
        logging.info("test error")
        continue
    except Exception:
        logging.info("exception")
        break
    finally:
        logging.info("finally")
